package com.icehelper.hades.base.util;

import java.security.SecureRandom;

/**
 * 随机工具类
 *
 * @author Leon Sun
 */
public class RandomUtil {


  /**
   * 获取随机数字字符串，长度为6
   */
  public static String getRandomStrWithNumber() {
    return getRandomStrWithNumber(6);
  }

  /**
   * 获取随机数字字符串，长度可约定
   *
   * @param randomLen 随机长度
   */
  public static String getRandomStrWithNumber(int randomLen) {
    StringBuilder sb = new StringBuilder();
    SecureRandom random = new SecureRandom();
    for (int i = 0; i < randomLen; i++) {
      sb.append(random.nextInt(10));
    }
    return sb.toString();
  }

}
